class Solution {
    public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
        int x1 = rec1[0], y1 = rec1[1];
        int x2 = rec1[2], y2 = rec1[3];
        int x3 = rec2[0], y3 = rec2[1];
        int x4 = rec2[2], y4 = rec2[3];
        return !(x2 <= x3 || x4 <= x1 || y2 <= y3 || y4 <= y1);
    }

    public boolean isRectangleOverlap2(int[] rec1, int[] rec2) {
        int x1 = rec1[0], y1 = rec1[1];
        int x2 = rec1[2], y2 = rec1[3];
        int x3 = rec2[0], y3 = rec2[1];
        int x4 = rec2[2], y4 = rec2[3];
        return Math.min(x2, x4) > Math.max(x1, x3) && Math.min(y2, y4) > Math.max(y1, y3);
    }

    public static void main(String[] args) {
        Solution s = new Solution();
        int[] arr1 = {0, 0, 2, 2};
        int[] arr2 = {1, 1, 3, 3};
        boolean res = s.isRectangleOverlap(arr1, arr2);
        System.out.println(res);
    }
}